@ECHO OFF

if "%OS%" == "Windows_NT" setlocal

if not "%JAVA_HOME%" == "" goto check_tool
 echo Please set the JAVA_HOME environment variable.
 goto end

:check_tool
if not "%JC_HOME%" == "" goto doit
 echo Please set the JC_HOME environment variable.
 goto end

:doit

set JC_PATH=.;%CL_DIR%;%JC_HOME%\lib\api.jar
set JCFLAGS=-g -d .\bin -source 1.2 -target 1.2 -classpath "%JC_PATH%"

if exist bin del /s /q bin
if not exist bin mkdir bin
xcopy /s /y %JC_HOME%\api_export_files\*.* bin\

%JAVA_HOME%\bin\javac %JCFLAGS% src\br\edu\fatec\ads\tcc\biblioteca\*.java

cd bin
call %JC_HOME%\bin\converter -config ..\src\BibliotecaApplet.opt

:end
if "%OS%" == "Windows_NT" endlocal
pause
